<?php
error_reporting(0);
require_once ('config.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>注册</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="global.css" type="text/css"/>
<script src="laydate/laydate.js"></script>
<style type="text/css">
.message-box{
width:88%;
margin-top:6%;
}
body{
padding-bottom:20px;
}
label{
display:block;
text-align:center;
font-size:14px;
padding:5px;
margin:auto;
width:60px;
}
hr{
margin:8px;
}
.title-img{
height:25px;
width:auto;
margin-bottom:-10px;
}
.ex-btn{
display:inline-block;
padding:8px;
}
.container{
display:block;
width:100%;
}
.message-box .btn{
float:none;
margin:auto;
margin-top:15px;
margin-bottom:10px;
}
a{
color:#fe6565;
display:inline-block;
position:static;
}
#wexin-login-btn{
margin-bottom:10px;
}
.message-box .content{
max-height:none;
margin-bottom:5px;
margin-top:5px;
}
.circle-icon{
width:18px;
height:18px;
border-radius:9px;
background-color:#F0BEE0;
}
.circle-icon span{
color:white;
}
.hint-box{
font-size:small;
}
input{
text-align:center;
}
p{
font-size:14px;
}
a{
font-size:14px;
}
#area-select{
cursor:pointer;
width: 186px;
text-align: center;
color: #444;
background-color: #fff;
background-size: auto 15px;
padding: 8px;
border-radius: 8px;
border: 1px solid #ddd;
}
</style>

<script language="javascript">
function chk(theForm)
{
	if (theForm.d_user_name.value.replace(/(^\s*)|(\s*$)/g, "") == ""){
		alert("error");
		theForm.d_user_name.focus();   
		return (false);   
	}		
	
	if (theForm.d_user_pass.value.replace(/(^\s*)|(\s*$)/g, "") == ""){
		alert("error");
		theForm.d_user_pass.focus();   
		return (false);   
	}	
	
	if (theForm.d_user_pass.value != theForm.pass.value){
		alert("error");
		theForm.pass.focus();   
		return (false);   
	}
}
</script>

</head>
<body>
<?php
if($_POST["submit"])
{
$_SESSION['d_user']=$_POST['d_user_name'];
$sql="insert into d_user values('','".$_POST['d_user_name']."','".$_POST['d_user_pass']."','".$_POST['d_user_nick']."','0')";
$result=mysql_query($sql)or die(mysql_error());
if($result)
echo "<script>alert('注册成功');location='member.php';</script>";
else
{
	echo "<script>alert('error');location='index.php';</script>";
	mysql_close();
}
}

?>

<div id="login-box" class="message-box" >
<header class="fruit-bg-header"></header>
<div class="content" >
	<section class="container" >
		<form id="theForm" name="theForm" method="post" action="" onSubmit="return chk(this)" runat="server" style="margin-bottom:0px;">
			<label >账号</label>
			<input name="d_user_name" type="text" id="d_user_name" placeholder="请输入账号">
      		<label >昵称</label>
      		<input name="d_user_nick" type="text" id="d_user_nick" placeholder="请输入昵称">
			<label >密码</label>
			<input name="d_user_pass" type="password" id="d_user_pass" placeholder="请输入密码"></br>
      		<label >确认密码</label>
      		<input name="pass" type="password" id="pass" placeholder="请确认密码"></br>
      		<input name="submit" type="submit" value="注册" class="btn" style="font-family: 微软雅黑"/>
		</form>
	<section class="container" >
</body>
</html>
